var rootPath = getRootPath();
/*
$(function(){
		$("#rigistNo").html("2121");
		});
*/
$(document).ready(function(){
	var userId = 84;
	var carId = 95;
	
	$.ajax({
		method : 'get',
		url : rootPath+'/wechat/api/maintain/selectLastMaintain?userId='+userId+'&carId='+carId, 
		error:function(XMLHttpRequest, ajaxOptions, thrownError){
			alert("连接服务器错误!");
		},
		success : function(resultData){

			var userId = ''; 	
			var registNo = ''; 	
			var modelName = ''; 	
			var carId = ''; 	
			var lastMaintainDate = ''; 
			var lastMaintainMileage = '';
			var nextMaintainMileage = '';
			
			$.each(resultData,function(lastMaintainIndex,lastMaintainObj){

				userId = lastMaintainObj.userId;
				registNo = lastMaintainObj.registNo;
				modelName = lastMaintainObj.modelName;
				carId = lastMaintainObj.carId;
				lastMaintainDate = lastMaintainObj.lastMaintainDate;
				lastMaintainMileage = lastMaintainObj.lastMaintainMileage;
				nextMaintainMileage = lastMaintainMileage + 20000;
			});

			$("#registNo").html(registNo);
			$("#carName").html(modelName);
			$("#lastMaintainDate").html(lastMaintainDate);
			$("#lastMaintainMileage").html(lastMaintainMileage);
			$("#nextMaintainMileage").html(nextMaintainMileage);
			$("#userId").val(userId);
			$("#carId").val(carId);
		}
	});
})